// pages/myPages/setPage/HandoverInChineseAndEnglish/HandoverInChineseAndEnglish.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    items: [
      { name: 'CHN', value: '中文'},
      { name: 'USA', value: '英文' },
    ],
    activeChecked:0,
    langVal:{},
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //console.log(wx.T)
    this.setData({
      activeChecked: wx.T.locale == 'en' ? 1 : (wx.T.locale =='zh-Hans'?0:''),
      langVal: wx.T.locale == "zh-Hans" ? wx.T.locales['zh-Hans'] : wx.T.locales['en']
    })
    wx.setNavigationBarTitle({
      title: wx.T.locale == "zh-Hans" ? wx.T.locales['zh-Hans'].moreLang : wx.T.locales['en'].moreLang
    })
    //console.log(this.data.langVal);
  },
  radioChange(e){
    // console.log(e)
    var navText = {}
    if (e.detail.value=='USA'){
      wx.T.setLocale('en')
      this.setData({
        langVal: wx.T.locales['en']
      })
      navText = wx.T.locales['en']
      wx.setStorageSync('lang', 'en')
    }else if(e.detail.value=='CHN'){
      wx.T.setLocale('zh-Hans')
      this.setData({
        langVal: wx.T.locales['zh-Hans']
      })
      navText = wx.T.locales['zh-Hans']
      wx.setStorageSync('lang', 'zh-Hans')
    }
    wx.setNavigationBarTitle({
      title: wx.T.locale == "zh-Hans" ? wx.T.locales['zh-Hans'].moreLang : wx.T.locales['en'].moreLang
    })
    var list =  [
      {
        "pagePath": "pages/assetPage/assetPage",
        "text": navText.JLTabBarPropertyText,
        "iconPath": "image/tab_zichan_normal.png",
        "selectedIconPath": "image/tab_zichan_selected.png"
      },
      {
        "pagePath": "pages/marketPage/marketPage",
        "text": navText.JLXXMarketQuotations,
        "iconPath": "image/tab_hangqing_normal.png",
        "selectedIconPath": "image/tab_hangqing_selected.png"
      },
      {
        "pagePath": "pages/transactionPage/transactionPage",
        "text": navText.JLTabBarTransactionText,
        "iconPath": "image/tab_jiaoyi_normal.png",
        "selectedIconPath": "image/tab_jiaoyi_selected.png"
      },
      {
        "pagePath": "pages/myPages/myPages",
        "text": navText.JLTabBarMineText,
        "iconPath": "image/tab_my_normal.png",
        "selectedIconPath": "image/tab_my_selected.png"
      }];
   list.map((res, index) => {
      wx.setTabBarItem({
        index: index,
        text: res.text,
        iconPath: res.iconPath,
        selectedIconPath: res.selectedIconPath
      })
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})